/*
 * Copyright 2006-2022 ahtelit.com, All Rights Reserved.
 */

package com.telit.android.feign;

import com.telit.android.entity.AppUserLocation;
import com.telit.android.feign.factory.RemoteAndroidServiceFallbackFactory;
import com.telit.common.entity.AppTask;
import com.telit.common.entity.CommEventTaskTrack;
import com.telit.common.entity.DataReturn;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * android feign
 *
 * @author yuezhuang
 * @since 2022-12-14
 */
@FeignClient(contextId = "remoteAndroidService", name = "yichang-android", fallbackFactory = RemoteAndroidServiceFallbackFactory.class)
public interface RemoteAndroidService {

    /**
     * 按护林员id查询正在任务中的护林员
     *
     * @param foresterIdList
     *
     * @return
     */
    @PostMapping(value = "/android/app-task/findTasking", produces = "application/json;charset=UTF-8")
    DataReturn findTaskingByUserIdPost(@RequestBody List<Long> foresterIdList);

    @GetMapping("/android/app-task-type/searchNoPageForFeign")
    DataReturn searchNoPageForFeign();

    @GetMapping("/android/app-task/findOne/{id}")
    @ApiOperation("根据id获取配置实体")
    @ApiImplicitParam(name = "id", value = "配置ID", paramType = "path", dataType = "Long")
    DataReturn findById(@PathVariable("id") Long id);

    @PostMapping(value = "/android/app-task/findTyeByIds", produces = "application/json;charset=UTF-8")
    @ApiOperation("根据id集合获取任务类型")
    @ApiImplicitParam(name = "ids", value = "配置ID", paramType = "body")
    DataReturn findTyeByIds(@RequestBody List<Long> ids);

    @PostMapping(value = "/android/app-location/selectSimpleDataByUserIds", produces = "application/json;charset=UTF-8")
    @ApiOperation("根据用户ID集合查询用户的点位数据")
    DataReturn selectSimpleDataByUserIds(@RequestBody List<Long> userIdList);

    @PostMapping(value = "/android/comm-event-task-track/updateCommEventTaskTrackByParam", produces = "application/json;charset=UTF-8")
    DataReturn updateCommEventTaskTrackByParam(@RequestBody CommEventTaskTrack commEventTaskTrack);

    @PostMapping(value = "/android/app-task/updateAppTaskByParam", produces = "application/json;charset=UTF-8")
    DataReturn updateAppTaskByParam(@RequestBody AppTask appTask);

    @GetMapping("/android/comm-event-task-track/selectIdByTaskIdAndStatus")
    DataReturn selectIdByTaskIdAndStatus(@RequestParam("taskId") Long taskId, @RequestParam("status") String status,
                                         @RequestParam("forestkeeperId") Long forestkeeperId);

    @GetMapping("/android/app-location/online-list")
    DataReturn<List<AppUserLocation>> onlineList();

}
